Omplus.views.LoginError = Omplus.base.extend(Omplus.views.TableRow, {
    omplusType: "LoginError",
    components:[
        {
            omplusName: "loginErrorValue",
            omplusType: "Label",
            model:"localValue"
        }
    ]
});

Omplus.base.define(Omplus.views.Panel, {
    omplusName: "loginPanel",
    renderTo: "body",
    height: "500px",
    showEffect:{
    	name:"fade",
        time:500
    },
    hideEffect:{
    	name:"fade",
        time:500
    },
    onCloseFinish : function(){
    	Omplus.globals.getObject("pagePanel").show();
        Omplus.globals.getObject("statusPanel").show();
    },
    components:[
        {
            omplusType:"Panel",
            omplusName:"loginPanelUsername",
            height: "60px",
            layout:{
                omplusType:"HorizontalLayout",
                width: "500px"
            },
            components:[

                {
                    omplusType:"Label",
                    omplusName:"labelUsername",
                    model:"Assets.list.label_username.localValue",
                    controller : "languageController",
                    width:"200px"
                },
                {
                    omplusType:"TextInput",
                    omplusName:"loginUsername",
                    model:"loginDetails.username",
                    controller : "userController",
                    width:"300px"
                }
            ]
        },
        {
            omplusType:"Panel",
            omplusName:"loginPanelPassword",
            height: "60px",
            layout:{
                omplusType:"HorizontalLayout",
                width: "500px"
            },
            components:[
                {
                    omplusType:"Label",
                    omplusName:"labelPassword",
                    model:"Assets.list.label_password.localValue",
                    controller : "languageController",
                    width:"200px"
                },
                {
                    omplusType:"PasswordInput",
                    omplusName:"loginPassword",
                    model:"loginDetails.password",
                    controller : "userController",
                    width:"300px"
                }
            ]
        },
        {
            omplusType:"Panel",
            omplusName:"loginPanelSubmit",
            height: "60px",
            layout:{
                omplusType:"HorizontalLayout",
                width: "200px"
            },
            components:[
                {
                    omplusType:"Button",
                    omplusName:"loginButton",
                    model:"Assets.list.label_login.localValue",
                    controller : "languageController",
                    width:"300px",
                    click : function(){
                        Omplus.globals.getObject("User").getAction("logIn").run();
                    }
                }
            ]
        },
        {
            omplusType:"Panel",
            omplusName:"loginPanelErrors",
            layout:{
                omplusType:"VerticalLayout",
                width: "300px"
            },
            components:[
                {
                    omplusType:"Table",
                    omplusName:"loginErrors",
                    model:"User.errors",
                    controller : "userController",
                    omplusProto:"LoginError",
                    generateModel : function(row, newValue){
                        return "Assets.list." + newValue[row].name;
                    },
                    generateController : function(){
                        return "languageController";
                    }
                }
            ]
        }
    ],
    layout:{
        omplusType:"VerticalLayout",
        width: "500px"
    }
});

Omplus.base.define(Omplus.views.Panel, {
    omplusName: "loginOverlay",
    renderTo: "body",
    height: "300px",
    width: "500px",
    showEffect:{
        name:"fade",
        time:1
    },
    hideEffect:{
        name:"fade",
        time:1
    }
});